package com.qianying.dto;

import com.qianying.entity.WorkOrder;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 工单返回数据 DTO（Data Transfer Object）
 */
@Data
public class WorkOrderDTO {

    private String workOrderNo;

    private String customerName;

    private String shopName;

    private String workOrderType;

    private LocalDateTime workOrderDate;

    private String workOrderState;

    private String urgency;

    private String businessDistrict;

    private String paymentMethod;

    private String contacts;

    private String province;

    private String city;

    private String county;

    private String address;

    private long userId;

    /**
     * DTO转实体
     */
    public WorkOrder toEntity() {
        WorkOrder entity = new WorkOrder();

        entity.setWorkOrderNo(this.workOrderNo);
        entity.setCustomerName(this.customerName);
        entity.setShopName(this.shopName);
        entity.setWorkOrderType(this.workOrderType);
        entity.setWorkOrderDate(this.workOrderDate);
        entity.setWorkOrderState(this.workOrderState);
        entity.setUrgency(this.urgency);
        entity.setBusinessDistrict(this.businessDistrict);
        entity.setPaymentMethod(this.paymentMethod);
        entity.setContacts(this.contacts);
        entity.setProvince(this.province);
        entity.setCity(this.city);
        entity.setCounty(this.county);
        entity.setAddress(this.address);

        return entity;
    }
}
